<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="Dodd">

    <title>Login</title>

    <!-- Bootstrap core CSS -->
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/login.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

  </head>

  <body>

    <div class="container">

      <form class="form-signin">
        <h2 class="form-signin-heading">Please Login</h2>
        <label for="inputId" class="sr-only">User Id</label>
        <input type="text" id="inputId" class="form-control" placeholder="User Id" required autofocus>
        <label for="inputPassword" class="sr-only">Password</label>
        <input type="password" id="inputPassword" class="form-control" placeholder="Password" required>
        <div class="checkbox">
          <label>
            <input type="checkbox" value="remember-me"> Remember me
          </label>
        </div>
        <button class="btn btn-lg btn-primary btn-block" type="button" onclick="login();">Sign in</button>
      </form>

    </div> <!-- /container -->
    <script type="text/javascript" src="js/jquery-3.0.0.min.js"></script>
    <script type="text/javascript" src="js/config.js"></script>
    <script type="text/javascript">
    //172.18.3.223
    function login() {
    	var res=$.ajax({
    	        type :"get",
    	        async:false,
    	        url : config.url.login,
    	        dataType : "jsonp",
    	        data: {"uid":$('#inputId').val(),"pwd":$('#inputPassword').val()},
    	        success : function(json){
    	            if(json.msg==='ok'){
    	            	window.location.href='home.html';
    	            }else{
    	            	alert("The data is not right!");
    	            }
    	        },
    	        error:function(){
    	            alert("Can't connet to server!");
    	        }
    	    });
    }
    </script>
  </body>
</html>
